#include "acceptrequest.h"
#include "ui_acceptrequest.h"

AcceptRequest::AcceptRequest(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::AcceptRequest)
{
    ui->setupUi(this);
    connect(ui->pushButton,SIGNAL(clicked()),this,SLOT(SendSlot()));
}

void AcceptRequest::SetInfo(QTcpSocket *s, QString u)
{
    socket = s;
    username = u;
    ui->label_username->setText(username);
}

void AcceptRequest::SetAccount(QString ac)
{
    this->account= ac;
}

AcceptRequest::~AcceptRequest()
{
    delete ui;
}

void AcceptRequest::SendSlot()
{
    MSG_ADD msg;

    strcpy(msg.username1,username.toStdString().c_str());
    strcpy(msg.username2,account.toStdString().c_str());
    qDebug()<<msg.username1;
    qDebug()<<msg.username2;
    socket->write((const char *)&msg,MSG_LENGTH);

}
